package org.lq.mi.util;
/**
 * 分页工具类
 * @author Administrator
 *
 */

import java.util.List;

public class Page<T> {

	private List<T> list;//数据源
	
	private int pageIndex;//当前页数
	
	private int pageSize;//每页显示行数
	
	private int totalPage;//总页数
	
	private int pageCount;//总行数
	
	
	public int getTotalPage() {
		this.totalPage = pageCount%pageSize == 0?pageCount/pageSize : pageCount/pageSize+1;
		return totalPage;
	}
	
	public void setPageIndex(int pageIndex) {
		if(pageIndex<=1) {
			this.pageIndex =1;
		}else if(pageIndex > getTotalPage()){
			this.pageIndex = totalPage;
		}else {
			this.pageIndex = pageIndex;
		}
	}

	public List<T> getList() {
		return list;
	}

	public void setList(List<T> list) {
		this.list = list;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getPageCount() {
		return pageCount;
	}

	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
		getTotalPage();
	}
	
	
	
	
	
}
